# include <cstdio>
# include <cstring>
# include <iostream>
# include <algorithm>
using namespace std;

# define testin freopen("in.txt", "r", stdin)
# define testout freopen("out.txt", "w", stdout)

# define rep(x) for(int i = 0; i < (x); ++i)
# define clr(x) memset(x, 0, sizeof(x))
# define clrc(x, c) memset(x, 0, (c)*sizeof(x[0]))

typedef unsigned long long int ulli;
typedef long long int lli;

const int maxn = 1005;
const ulli MOD = 1000000007;

int n;
char s[maxn];
int c[maxn];
ulli f[maxn][maxn];

ulli dp(int x, int y)
{
    if (f[x][y] != -1) return f[x][y];
    if (x+1<y) return f[x][y] = 0;
    if (x==0) {
        if (y < 1) return f[x][y] = 1;
        if (y==1) {
            if (s[0] == '1') return f[x][y] = 1;
            else if (c[0]+y < n) return f[x][y] = 1;
        }
    }
    if (s[x] == '1') {
        return f[x][y] = (dp(x-1, y) + dp(x-1, y-1)) % MOD;
    } else {
        if (c[x]+y < n) {
            return f[x][y] = ( dp(x-1, y) + dp(x-1, y-1) ) % MOD;
        } else {
            return f[x][y] = dp(x-1, y);
        }
    }
    return f[x][y];
}

int main()
{
    while (cin >> n >> s) {
        clr(f);
        clr(c);
        int len = strlen(s);
        c[0] = s[len-1]-'0';
        for (int i = len-2; i>=0; --i) if (s[i] == '1') c[i] = c[i+1]+1; else c[i] = c[i+1];
        ulli ans = dp(len-1, n);
        cout << ans << endl;
    }

    return 0;
}
